#include <stdio.h>
#define N 10 //假设棋盘最多10*10的大小

void ReadBroad(int broad[][N],int m,int n);
int fun(int broad[][N],int m,int n,int key,int pieces[][2]);
void PrintPieces(int pieces[][2],int n);

int key;

int main()
{
    int m,n;
    int i,j;
    int broad[N][N];
    int pieces[N][2];
    int key;
    printf("Please Input m & n:");
    scanf("%d %d",&m,&n);
    ReadBroad(broad, m, n);
    printf("Please Input the piece want to find:");
    scanf("%d", &key);
    int count =fun(broad,m,n,key,pieces);
    if(count!=0)
    {
        printf("There are %d pieces with value of %d:\n", count,key);
        PrintPieces(pieces, n);
    }
    else
    {
        printf("None");
    }
    return 0;
}

void ReadBroad(int broad[][N],int m,int n)
{
    int i,j;
    printf("Please Input Broad:\n");
    for(i=0;i<m;i++)
    {
        for(j=0;j<n;j++)
        {
            scanf("%d",&broad[i][j]);
        }
    }
    return;
}

int fun(int broad[][N],int m,int n,int key,int pieces[][2])
{
    int count=0;
    int i,j;
    for(i=0;i<m;i++)
    {
        for(j=0;j<n;j++)
        {
            if(broad[i][j]==key)
            {
                pieces[count][0]=i;
                pieces[count][1]=j;
                count++;
            }
        }
    }
    return count;
}

void PrintPieces(int pieces[][2],int n)
{
    int i;
    for (i = 0; i < n; i++)
    {
        printf("%d %d\n",pieces[i][0],pieces[i][1]);
    }
    return;
}